const mySymbol = (function () {
    const cache = new Map() // 函数内部变量
    function fn(key) {
        if (this instanceof fn) {
            throw new Error("connot constuctor")
        }
        return {}
    }

    fn.for = function (key) {
        if (!cache.has(key)) {
            cache.set(key, {})
        }
        return cache.get(key)
    }

    fn.keyfor = function (val) {
        for (let [k, v] in this.cache) {  // 可以直接使用for of
            if (v === val) {
                return k
            }
        }
    }

    return fn
})()